package com.evl.dictionaryConfig.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.evl.common.persistence.dao.DictionaryConfigMapper;
import com.evl.common.persistence.model.DictionaryConfig;
import com.evl.dictionaryConfig.DictConfig;
import com.evl.dictionaryConfig.service.IDictionaryConfigService;

/**
 * <p>
 * 系统配置管理
 * </p>
 *
 * @author dangsheng
 * @since 2017-07-13
 */
@Service
public class DictionaryConfigServiceImpl implements IDictionaryConfigService {

	@Resource
	private DictionaryConfigMapper dictionaryConfigMapper;
	
	@Override
	public List<DictionaryConfig> selectList(DictionaryConfig vo) {
		return dictionaryConfigMapper.selectList(vo);
	}

	@Override
	public int insert(DictionaryConfig vo) {
		vo.setCreateTime(new Date());
		int count = dictionaryConfigMapper.insert(vo);
		//刷新系统实例
		DictConfig.refresh();
		return count;
	}

	@Override
	public int update(DictionaryConfig vo) {
		vo.setCreateTime(new Date());
		int count = dictionaryConfigMapper.updateById(vo);
		//刷新系统实例
		DictConfig.refresh();
		return count;
	}

	@Override
	public DictionaryConfig selectById(String id) {
		return dictionaryConfigMapper.selectById(id);
	}

	@Override
	public List<DictionaryConfig> selectAll() {
		return selectList(new DictionaryConfig());
	}
	
}
